<%- if @elements.blank? -%>
  <div class="info">
    <%= render_icon('info') %>
    <%= Alchemy.t(:no_more_elements_to_add) %>
  </div>
<%- else -%>
  <%= alchemy_form_for [:admin, @element] do |form| %>
    <%= form.hidden_field :page_id %>
  <%- if @page.can_have_cells? && @parent_element.blank? -%>
    <%= form.input :name,
      label: Alchemy.t(:element_of_type),
      collection: grouped_elements_for_select(@elements),
      as: :grouped_select,
      group_method: :second,
      prompt: Alchemy.t(:select_element),
      input_html: {class: 'alchemy_selectbox', autofocus: true} %>
  <%- else -%>
    <%= form.input :name,
      label: Alchemy.t(:element_of_type),
      collection: elements_for_select(@elements),
      prompt: Alchemy.t(:select_element),
      input_html: {class: 'alchemy_selectbox', autofocus: true} %>
  <%- end -%>
    <%= form.hidden_field :parent_element_id, value: @parent_element.try(:id) %>
    <%= form.submit Alchemy.t(:add) %>
  <%- end -%>
<%- end -%>
